package com.carcenter.order.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.carcenter.common.model.dto.OrderInfoQueryDto;
import com.carcenter.common.model.vo.OrderInfoVo;
import com.carcenter.common.page.MyPageData;
import com.carcenter.common.result.Result;
import com.carcenter.order.service.IOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author car
 * @since 2025-07-16
 */
@RestController
@RequestMapping("/order-info")
public class OrderInfoController {

    @Autowired
    private IOrderInfoService orderInfoService;
    @PostMapping("/getOrderList/{pageNum}/{pageSize}")
    public Result getOrderList(@PathVariable Integer pageNum,
                          @PathVariable Integer pageSize,
                          @RequestBody OrderInfoQueryDto queryDto){
        IPage<OrderInfoVo> page = orderInfoService.getOrderList(pageNum,pageSize,queryDto);
        MyPageData data = new MyPageData(page.getTotal(),page.getRecords());
        return Result.ok(data);
    }

}
